<?php

/**
 * Application Models
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 * @copyright ZF model generator
 * @license http://framework.zend.com/license/new-bsd     New BSD License
 */

/**
 * Abstract class for models
 */
require_once 'ModelAbstract.php';

/**
 * 
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 */
class Application_Model_PilotDataelement extends Application_Model_ModelAbstract
{

    /**
     * Database var type int(11)
     *
     * @var int
     */
    protected $_IdPILOTDATAELEMENT;

    /**
     * Database var type varchar(512)
     *
     * @var string
     */
    protected $_COLUMNNAME;

    /**
     * Database var type text
     *
     * @var text
     */
    protected $_COLUMNVALUE;

    /**
     * Database var type int(11)
     *
     * @var int
     */
    protected $_PILOTENREGISTREMENTIdPILOTENREGISTREMENT;


    /**
     * Parent relation fk_PILOT_DATAELEMENT_PILOT_ENREGISTREMENT1
     *
     * @var Application_Model_PilotEnregistrement
     */
    protected $_PilotEnregistrement;


    /**
     * Sets up column and relationship lists
     */
    public function __construct()
    {
        parent::init();
        $this->setColumnsList(array(
            'idPILOT_DATAELEMENT'=>'IdPILOTDATAELEMENT',
            'COLUMNNAME'=>'COLUMNNAME',
            'COLUMNVALUE'=>'COLUMNVALUE',
            'PILOT_ENREGISTREMENT_idPILOT_ENREGISTREMENT'=>'PILOTENREGISTREMENTIdPILOTENREGISTREMENT',
        ));

        $this->setParentList(array(
            'FkPILOTDATAELEMENTPILOTENREGISTREMENT1'=> array(
                    'property' => 'PilotEnregistrement',
                    'table_name' => 'PilotEnregistrement',
                ),
        ));

        $this->setDependentList(array(
        ));
    }

    /**
     * Sets column idPILOT_DATAELEMENT
     *
     * @param int $data
     * @return Application_Model_PilotDataelement
     */
    public function setIdPILOTDATAELEMENT($data)
    {
        $this->_IdPILOTDATAELEMENT = $data;
        return $this;
    }

    /**
     * Gets column idPILOT_DATAELEMENT
     *
     * @return int
     */
    public function getIdPILOTDATAELEMENT()
    {
        return $this->_IdPILOTDATAELEMENT;
    }

    /**
     * Sets column COLUMNNAME
     *
     * @param string $data
     * @return Application_Model_PilotDataelement
     */
    public function setCOLUMNNAME($data)
    {
        $this->_COLUMNNAME = $data;
        return $this;
    }

    /**
     * Gets column COLUMNNAME
     *
     * @return string
     */
    public function getCOLUMNNAME()
    {
        return $this->_COLUMNNAME;
    }

    /**
     * Sets column COLUMNVALUE
     *
     * @param text $data
     * @return Application_Model_PilotDataelement
     */
    public function setCOLUMNVALUE($data)
    {
        $this->_COLUMNVALUE = $data;
        return $this;
    }

    /**
     * Gets column COLUMNVALUE
     *
     * @return text
     */
    public function getCOLUMNVALUE()
    {
        return $this->_COLUMNVALUE;
    }

    /**
     * Sets column PILOT_ENREGISTREMENT_idPILOT_ENREGISTREMENT
     *
     * @param int $data
     * @return Application_Model_PilotDataelement
     */
    public function setPILOTENREGISTREMENTIdPILOTENREGISTREMENT($data)
    {
        $this->_PILOTENREGISTREMENTIdPILOTENREGISTREMENT = $data;
        return $this;
    }

    /**
     * Gets column PILOT_ENREGISTREMENT_idPILOT_ENREGISTREMENT
     *
     * @return int
     */
    public function getPILOTENREGISTREMENTIdPILOTENREGISTREMENT()
    {
        return $this->_PILOTENREGISTREMENTIdPILOTENREGISTREMENT;
    }

    /**
     * Sets parent relation PILOTENREGISTREMENTIdPILOTENREGISTREMENT
     *
     * @param Application_Model_PilotEnregistrement $data
     * @return Application_Model_PilotDataelement
     */
    public function setPilotEnregistrement(Application_Model_PilotEnregistrement $data)
    {
        $this->_PilotEnregistrement = $data;

        $primary_key = $data->getPrimaryKey();
        if (is_array($primary_key)) {
            $primary_key = $primary_key['idPILOT_ENREGISTREMENT'];
        }

        $this->setPILOTENREGISTREMENTIdPILOTENREGISTREMENT($primary_key);

        return $this;
    }

    /**
     * Gets parent PILOTENREGISTREMENTIdPILOTENREGISTREMENT
     *
     * @param boolean $load Load the object if it is not already
     * @return Application_Model_PilotEnregistrement
     */
    public function getPilotEnregistrement($load = true)
    {
        if ($this->_PilotEnregistrement === null && $load) {
            $this->getMapper()->loadRelated('FkPILOTDATAELEMENTPILOTENREGISTREMENT1', $this);
        }

        return $this->_PilotEnregistrement;
    }

    /**
     * Returns the mapper class for this model
     *
     * @return Application_Model_Mapper_PilotDataelement
     */
    public function getMapper()
    {
        if ($this->_mapper === null) {
            $this->setMapper(new Application_Model_Mapper_PilotDataelement());
        }

        return $this->_mapper;
    }

    /**
     * Deletes current row by deleting the row that matches the primary key
     *
	 * @see Application_Model_Mapper_PilotDataelement::delete
     * @return int|boolean Number of rows deleted or boolean if doing soft delete
     */
    public function deleteRowByPrimaryKey()
    {
        if ($this->getIdPILOTDATAELEMENT() === null) {
            throw new Exception('Primary Key does not contain a value');
        }

        return $this->getMapper()
                    ->getDbTable()
                    ->delete('idPILOT_DATAELEMENT = ' .
                             $this->getMapper()
                                  ->getDbTable()
                                  ->getAdapter()
                                  ->quote($this->getIdPILOTDATAELEMENT()));
    }
}
